Repository navigation
Avoid encoding old values in complete element writeback - #673
Merged
Merged
Conversation
Contributor
|
Remove the benchmark and run |
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
perfloop
Bot
force-pushed
the
perfloop-pr-open-jy0nmh05jx
branch
from
November 20, 2026 20:22
e6d86fd to
2d014bc
Compare
Contributor
Author
|
The benchmark and its Cargo registration have been removed, and the project formatter has been run. The writeback optimization and its regression test remain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reads into typed buffers serialize destination elements again during writeback, even when incoming bytes replace the whole element. Skip that discarded work in the shared byte-write path while preserving bytes outside the written range.
In
libcc2rs/src/reinterpret.rs, writeback handles a partial first element, assigns complete elements from incoming chunks, then handles a partial last element. Only the partial elements need their old bytes encoded. Empty affected ranges return after bounds validation. The single-element shortcut and variable-sized handling remain. All assignments still useassign_bytes, including array-length-preserving overrides.Ptr::with_slice_mutcontinues preparing the original bytes before invoking its callback.Reading 3,032 bytes of
README.mdinto boxedu64storage measured median process CPU of 4,800 → 3,800 ns per seek/read cycle. The paired median change was −1,075 ns, with sequential median bounds of −1,750 to −500 ns from 22 complete pairs. Each invocation repeats 200,000 cycles with the same destination.Results apply to warm file data and a reused destination. Initial destination preparation, native
u8/i8storage and variable-sized writes are unchanged.The Cargo pointer and field tests passed in debug and release: 6 pointer tests and 1 field test per configuration, with no failures or ignored tests. Coverage in
libcc2rs/src/rc.rschecks skipped old-value encoding, preserved boundary bytes, callback inputs and assignment overrides.Case and evidence
Made by Perfloop.